Hi, I'm trying to check if a linked module has a certain attribute (Release Number) and if it does then go into the linked object, then go up one level to the Parent object and bring back information in the Release Number attribute.
// DXL generated by DOORS traceability wizard on 09 March 2012.
// Wizard version 2.0, DOORS version 9.3.0.5
pragma runLim, 0
string limitModules[1] = {"48c520b3464303c3-0000b4ad"}
void showIn(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
Object PO
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
for lr in all(o<-linkModName) do {
otherMod = module (sourceVersion lr)
if (!null otherMod) {
if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue
load((sourceVersion lr),false)
}
}
}
for l in all(o<-linkModName) do {
otherVersion = sourceVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue
othero = source l
if (null othero) {
load(otherVersion,false)
}
othero = source l
if (null othero) continue
if (isDeleted othero) continue
doneOne = true
if (depth == 1) {
s = name(otherMod)
if (isBaseline(otherVersion)) {
s = s " [" versionString(otherVersion) "]"
}
disp = disp s
if (exists attribute "Release Number")
s = probeRichAttr_(othero,"Release Number", true)
if (parent obj != null)
{PO = parent othero
s = PO."Release Number"
disp = disp "-" s
displayRich("\\pard " disp)
}
}
}
}
showIn(obj,1)
dnmel0 - Mon Mar 12 02:21:16 EDT 2012 |
Re: Check if attribute exists if so bring back parent object information
I'm in a hurry so I'll scribble. The "if exists attribute" line should fail since you don't know which module is currently "current". Perhaps you want to display the value if it has one, figuring if the attribute doesn't exist then it has no value.
// s = name(otherMod)
// if (isBaseline(otherVersion)) {
// s = s " [" versionString(otherVersion) "]"
// }
// disp = disp s
// if (exists attribute "Release Number")
// s = probeRichAttr_(othero,"Release Number", true)
// if (parent obj != null)
// s = PO."Release Number"
disp = disp "-" s
displayRich("\\pard " disp)
PO = parent othero
if (!null PO) //
then s = probeAttr_(PO."Release Number") //<<-- returns "" if there is no such attr
else s = ""
if (!null s) then displayRich("\\pard " s)
|
Re: Check if attribute exists if so bring back parent object information -E- DXL: <Line:57> incorrect arguments for (if) -E- DXL: <Line:58> incorrect arguments for function (probeAttr_) -I- DXL: all done with 2 errors and 0 warnings Also I was wanting to add the name of the other module in front of the release number, if possible? Thanks, Dan |
Re: Check if attribute exists if so bring back parent object information dnmel0 - Mon Mar 12 23:35:38 EDT 2012
You want it to work? Sheesh. :)
// disp = disp "-" s // forgot to comment these out originally
// displayRich("\\pard " disp)
PO = parent othero
if (!null PO) //
then s = probeAttr_(PO, "Release Number") //<<-- returns "" if there is no such attr
else s = ""
if (!null s)
{ string Name = name(otherMod)
if (isBaseline(otherVersion)) {
Name = Name " [" versionString(otherVersion) "]"
}
Option1:
display(Name)
displayRich("\\pard " s) // on separate lines
Option2:
displayRich("\\pard " Name ": " s) // on one line.
}
|
Re: Check if attribute exists if so bring back parent object information Cheers, Dan. |